package com.avantis.common.entity;

import com.avantis.common.entity.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * @ClassName Permission
 * @Description TODO
 * @Author kirago
 * @Date 2018/11/26 19:14
 * @Version 1.0
 **/
@Entity
@Table(name = "k_permission")
@Data
public class Permission extends BaseEntity implements Serializable {

	@Column
	private String perUrl;

	@Column
	private String name;

	//资源类型　　1：关联仓库　2：价格权限
	@Column
	private Integer type;

	//父权限
	@Column(nullable = false)
	private Long parentId;

	//排序
	private Integer sort=0;

	//是否选中
	@Transient
	private Integer checked=0;

	@JsonIgnore
	@ManyToMany(mappedBy = "permissions")
	private Set<Role> roles = new HashSet<>();

}

